import request from '@/utils/request.js'

//学生登录
export  const login =(LoginData)=>{
    const param = new URLSearchParams();
    for (let key in LoginData) {
        param.append(key,LoginData[key])
    }
    return request.post('/student/login',param)
}

//学生注册
export const register = (RegisterData)=>{
    return request.post('/student/register',RegisterData)
}
//新增用户
export const addUser = (student)=>{
    return request.post('/student/add',student)
}

//获取学生列表
export const getUserList = (pageNum,pageSize,username,address)=>{
    const params = {
        pageNum: pageNum,
        pageSize: pageSize,
        username: username,
        address: address
    }
    return request.get('/student/pageList',{params})
}

//修改学生账号状态
export const updateUserStatus = (studentId, status) => {
    const params = {
        studentId: studentId,
        status: status
    }
    return request.put('/student/updateStatus', params)
}

//更新学生信息
export const updateUserInfo = (studentInfo)=>{
    return request.put('/student/update',studentInfo)
}

